<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>xilsecure: xsecure_elliptic.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">xilsecure
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;"
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xsecure__elliptic_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xsecure_elliptic.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains the implementation of the interface functions for ECC engine. </p>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver   Who  Date     Changes
</p>
<hr/>
<p>
1.0   rpo 03/31/20  Initial release
4.2   rpo 03/31/20  Updated file version to sync with library version
4.3   har 08/24/20  Added APIs to generate and verify ECDSA public key and
                    signature
                    Added support for ECDSA P521 curve
      am  09/25/20  Resolved MISRA C violations
      har 10/12/20  Addressed security review comments
      har 10/14/20  Replaced ecdsa with elliptic in names of function and
                    macros
4.5   har 01/18/20  Added support for ECDSA P521 KAT
      kpt 02/14/21  Added redundancy for ECDSA hash length check
      har 03/22/21  Added volatile keyword to status variables used in
                    XSECURE_TEMPORAL_CHECK
4.6   har 07/14/21  Fixed doxygen warnings
      gm  07/16/21  Added support for 64-bit address
      rb  08/11/21  Fix compilation warnings
      har 09/13/21  Fixed signature verification issue for P521 curve
4.7   am  01/07/22  Removed unused labels KEY_ERR and SIG_ERR by replacing
                    XSECURE_TEMPORAL_CHECK with XSECURE_TEMPORAL_IMPL macros and
                    status variable is reinitialized with XST_FAILURE before using
                    it further in the respective functions
      har  01/20/22 Added glitch checks for clearing keys in
                    <a class="el" href="group__xsecure__ecdsa__server__apis.html#ga682282def21e1c86ab583cdd41090fbb" title="This function generates Public Key for a given curve type using private key where both keys located a...">XSecure_EllipticGenerateKey_64Bit()</a> and
                    <a class="el" href="group__xsecure__ecdsa__server__apis.html#ga3af7e8a366bb982fa4c0c82be1b37250" title="This function generates signature for a given hash and curve type where data is located at 64-bit add...">XSecure_EllipticGenerateSignature_64Bit()</a>
      har  02/16/22 Updated Status with ClearStatus only in case of success
      dc   07/13/22 Modified static function <a class="el" href="group__xsecure__ecdsa__server__apis.html#ga0219841abd9a6a67cd5e80f8a5ec0d30" title="This function gets the curve related information. ">XSecure_EllipticGetCrvData()</a>
                    to non static
5.0   kpt  07/24/22 Moved XSecure_EllipticKat into <a class="el" href="xsecure__kat_8c.html" title="This file contains known answer tests common for both Versal and VersalNet. ">xsecure_kat.c</a>
      dc   08/26/22 Removed initializations of arrays
5.1   dc   03/30/23 Added support to accept the data in either big/little endian.
5.2   yog  05/18/23 Updated the flow for Big Endian ECC Mode setting
      yog  06/07/23 Added support for P-256 Curve
      ng   07/05/23 Added support for system device tree flow
      yog  08/07/23 Initialised trng before calling IpCores functions
      am   08/18/23 Added XSecure_EllipticValidateAndGetCrvInfo and
                    XSecure_EllipticGetCrvSize functions
      yog  09/04/23 Restricted XSecure_ECCRandInit API support to VersalNet
      vss  09/11/23 Fixed MISRA-C Rule 8.13 violation
5.3   kpt  03/22/24 Fixed Branch past initialization
5.4   yog  04/29/24 Fixed doxygen warnings.
      mb   05/23/24 Added P192 curve support
      mb   05/23/24 Added P224 urve support</pre><pre></pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga5bce9c7826b6403ae45442ead7f1cd65"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#ga5bce9c7826b6403ae45442ead7f1cd65">XSECURE_ECDSA_ALGN_CRV_SIZE_IN_BYTES</a>&#160;&#160;&#160;(2U)</td></tr>
<tr class="memdesc:ga5bce9c7826b6403ae45442ead7f1cd65"><td class="mdescLeft">&#160;</td><td class="mdescRight">Align ECDSA curve size in bytes.  <a href="group__xsecure__ecdsa__server__apis.html#ga5bce9c7826b6403ae45442ead7f1cd65">More...</a><br/></td></tr>
<tr class="separator:ga5bce9c7826b6403ae45442ead7f1cd65"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab4f953836088ef7ce1b74abd75023bde"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#gab4f953836088ef7ce1b74abd75023bde">XSECURE_ECDSA_BITS_IN_BYTES</a>&#160;&#160;&#160;(8U)</td></tr>
<tr class="memdesc:gab4f953836088ef7ce1b74abd75023bde"><td class="mdescLeft">&#160;</td><td class="mdescRight">Bits in bytes.  <a href="group__xsecure__ecdsa__server__apis.html#gab4f953836088ef7ce1b74abd75023bde">More...</a><br/></td></tr>
<tr class="separator:gab4f953836088ef7ce1b74abd75023bde"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga0219841abd9a6a67cd5e80f8a5ec0d30"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_ecdsa_crv_info.html">EcdsaCrvInfo</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#ga0219841abd9a6a67cd5e80f8a5ec0d30">XSecure_EllipticGetCrvData</a> (<a class="el" href="group__xsecure__common__apis.html#ga7aecdb57be4a4242f11ad3e3bebb42e6">XSecure_EllipticCrvTyp</a> CrvTyp)</td></tr>
<tr class="memdesc:ga0219841abd9a6a67cd5e80f8a5ec0d30"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function gets the curve related information.  <a href="group__xsecure__ecdsa__server__apis.html#ga0219841abd9a6a67cd5e80f8a5ec0d30">More...</a><br/></td></tr>
<tr class="separator:ga0219841abd9a6a67cd5e80f8a5ec0d30"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga682282def21e1c86ab583cdd41090fbb"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#ga682282def21e1c86ab583cdd41090fbb">XSecure_EllipticGenerateKey_64Bit</a> (<a class="el" href="group__xsecure__common__apis.html#ga7aecdb57be4a4242f11ad3e3bebb42e6">XSecure_EllipticCrvTyp</a> CrvType, const u64 DAddr, const <a class="el" href="struct_x_secure___elliptic_key_addr.html">XSecure_EllipticKeyAddr</a> *KeyAddr)</td></tr>
<tr class="memdesc:ga682282def21e1c86ab583cdd41090fbb"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function generates Public Key for a given curve type using private key where both keys located at 64 bit address.  <a href="group__xsecure__ecdsa__server__apis.html#ga682282def21e1c86ab583cdd41090fbb">More...</a><br/></td></tr>
<tr class="separator:ga682282def21e1c86ab583cdd41090fbb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3fcdd9235bcbb13f538c106bc6e32bcf"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#ga3fcdd9235bcbb13f538c106bc6e32bcf">XSecure_EllipticGenerateKey</a> (<a class="el" href="group__xsecure__common__apis.html#ga7aecdb57be4a4242f11ad3e3bebb42e6">XSecure_EllipticCrvTyp</a> CrvType, const u8 *<a class="el" href="xsecure__lms_8h.html#ab14788fbc92abcbc0e153a93b1f28cd2">D</a>, const <a class="el" href="struct_x_secure___elliptic_key.html">XSecure_EllipticKey</a> *Key)</td></tr>
<tr class="memdesc:ga3fcdd9235bcbb13f538c106bc6e32bcf"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function generates Public Key for a given curve type.  <a href="group__xsecure__ecdsa__server__apis.html#ga3fcdd9235bcbb13f538c106bc6e32bcf">More...</a><br/></td></tr>
<tr class="separator:ga3fcdd9235bcbb13f538c106bc6e32bcf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3af7e8a366bb982fa4c0c82be1b37250"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#ga3af7e8a366bb982fa4c0c82be1b37250">XSecure_EllipticGenerateSignature_64Bit</a> (<a class="el" href="group__xsecure__common__apis.html#ga7aecdb57be4a4242f11ad3e3bebb42e6">XSecure_EllipticCrvTyp</a> CrvType, const <a class="el" href="struct_x_secure___elliptic_hash_data.html">XSecure_EllipticHashData</a> *HashInfo, const u64 DAddr, const u64 KAddr, const <a class="el" href="struct_x_secure___elliptic_sign_addr.html">XSecure_EllipticSignAddr</a> *SignAddr)</td></tr>
<tr class="memdesc:ga3af7e8a366bb982fa4c0c82be1b37250"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function generates signature for a given hash and curve type where data is located at 64-bit address.  <a href="group__xsecure__ecdsa__server__apis.html#ga3af7e8a366bb982fa4c0c82be1b37250">More...</a><br/></td></tr>
<tr class="separator:ga3af7e8a366bb982fa4c0c82be1b37250"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gacfb2a9d041a4b449a47874add5f01547"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#gacfb2a9d041a4b449a47874add5f01547">XSecure_EllipticGenerateSignature</a> (<a class="el" href="group__xsecure__common__apis.html#ga7aecdb57be4a4242f11ad3e3bebb42e6">XSecure_EllipticCrvTyp</a> CrvType, const u8 *Hash, const u32 HashLen, const u8 *<a class="el" href="xsecure__lms_8h.html#ab14788fbc92abcbc0e153a93b1f28cd2">D</a>, const u8 *<a class="el" href="xsecure__lms__ots_8h.html#a1409f77262465120c3094dcd039e1f32">K</a>, const <a class="el" href="struct_x_secure___elliptic_sign.html">XSecure_EllipticSign</a> *Sign)</td></tr>
<tr class="memdesc:gacfb2a9d041a4b449a47874add5f01547"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function generates signature for a given hash and curve type.  <a href="group__xsecure__ecdsa__server__apis.html#gacfb2a9d041a4b449a47874add5f01547">More...</a><br/></td></tr>
<tr class="separator:gacfb2a9d041a4b449a47874add5f01547"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab83385dfd83a7bfdef4d74ec412e15c6"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#gab83385dfd83a7bfdef4d74ec412e15c6">XSecure_EllipticValidateKey_64Bit</a> (<a class="el" href="group__xsecure__common__apis.html#ga7aecdb57be4a4242f11ad3e3bebb42e6">XSecure_EllipticCrvTyp</a> CrvType, const <a class="el" href="struct_x_secure___elliptic_key_addr.html">XSecure_EllipticKeyAddr</a> *KeyAddr)</td></tr>
<tr class="memdesc:gab83385dfd83a7bfdef4d74ec412e15c6"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function validates the public key for a given curve type where key is located at 64-bit address.  <a href="group__xsecure__ecdsa__server__apis.html#gab83385dfd83a7bfdef4d74ec412e15c6">More...</a><br/></td></tr>
<tr class="separator:gab83385dfd83a7bfdef4d74ec412e15c6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga35ed639454381d4bcf89858e55b9c980"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#ga35ed639454381d4bcf89858e55b9c980">XSecure_EllipticValidateKey</a> (<a class="el" href="group__xsecure__common__apis.html#ga7aecdb57be4a4242f11ad3e3bebb42e6">XSecure_EllipticCrvTyp</a> CrvType, const <a class="el" href="struct_x_secure___elliptic_key.html">XSecure_EllipticKey</a> *Key)</td></tr>
<tr class="memdesc:ga35ed639454381d4bcf89858e55b9c980"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function validates the public key for a given curve type.  <a href="group__xsecure__ecdsa__server__apis.html#ga35ed639454381d4bcf89858e55b9c980">More...</a><br/></td></tr>
<tr class="separator:ga35ed639454381d4bcf89858e55b9c980"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0bb6ca50d138b482eb9a5d9f18e398d8"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#ga0bb6ca50d138b482eb9a5d9f18e398d8">XSecure_EllipticVerifySign_64Bit</a> (<a class="el" href="group__xsecure__common__apis.html#ga7aecdb57be4a4242f11ad3e3bebb42e6">XSecure_EllipticCrvTyp</a> CrvType, const <a class="el" href="struct_x_secure___elliptic_hash_data.html">XSecure_EllipticHashData</a> *HashInfo, const <a class="el" href="struct_x_secure___elliptic_key_addr.html">XSecure_EllipticKeyAddr</a> *KeyAddr, const <a class="el" href="struct_x_secure___elliptic_sign_addr.html">XSecure_EllipticSignAddr</a> *SignAddr)</td></tr>
<tr class="memdesc:ga0bb6ca50d138b482eb9a5d9f18e398d8"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function verifies the signature for a given hash, key and curve type where data is located at 64-bit address.  <a href="group__xsecure__ecdsa__server__apis.html#ga0bb6ca50d138b482eb9a5d9f18e398d8">More...</a><br/></td></tr>
<tr class="separator:ga0bb6ca50d138b482eb9a5d9f18e398d8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7d2dfbb593a38b3bb47d1ab26fb0cfea"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#ga7d2dfbb593a38b3bb47d1ab26fb0cfea">XSecure_EllipticVerifySign</a> (<a class="el" href="group__xsecure__common__apis.html#ga7aecdb57be4a4242f11ad3e3bebb42e6">XSecure_EllipticCrvTyp</a> CrvType, const u8 *Hash, const u32 HashLen, const <a class="el" href="struct_x_secure___elliptic_key.html">XSecure_EllipticKey</a> *Key, const <a class="el" href="struct_x_secure___elliptic_sign.html">XSecure_EllipticSign</a> *Sign)</td></tr>
<tr class="memdesc:ga7d2dfbb593a38b3bb47d1ab26fb0cfea"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function verifies the signature for a given hash, key and curve type.  <a href="group__xsecure__ecdsa__server__apis.html#ga7d2dfbb593a38b3bb47d1ab26fb0cfea">More...</a><br/></td></tr>
<tr class="separator:ga7d2dfbb593a38b3bb47d1ab26fb0cfea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaeae4245a96b56ed57680a2df01da5944"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#gaeae4245a96b56ed57680a2df01da5944">XSecure_PutData</a> (const u32 Size, u8 *Dst, const u64 SrcAddr)</td></tr>
<tr class="memdesc:gaeae4245a96b56ed57680a2df01da5944"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function copies data from 32/64 bit address to local buffer.  <a href="group__xsecure__ecdsa__server__apis.html#gaeae4245a96b56ed57680a2df01da5944">More...</a><br/></td></tr>
<tr class="separator:gaeae4245a96b56ed57680a2df01da5944"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4b04814c049951cd68c6f1a32ffcb707"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#ga4b04814c049951cd68c6f1a32ffcb707">XSecure_GetData</a> (const u32 Size, const u8 *Src, const u64 DstAddr)</td></tr>
<tr class="memdesc:ga4b04814c049951cd68c6f1a32ffcb707"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function copies data to 32/64 bit address from local buffer.  <a href="group__xsecure__ecdsa__server__apis.html#ga4b04814c049951cd68c6f1a32ffcb707">More...</a><br/></td></tr>
<tr class="separator:ga4b04814c049951cd68c6f1a32ffcb707"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab4982b81bdf14b95cfbf9ec1be61bf61"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#gab4982b81bdf14b95cfbf9ec1be61bf61">XSecure_FixEndiannessNCopy</a> (const u32 Size, u64 DstAddr, const u64 SrcAddr)</td></tr>
<tr class="memdesc:gab4982b81bdf14b95cfbf9ec1be61bf61"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function copies data to destination based on library endianness selection.  <a href="group__xsecure__ecdsa__server__apis.html#gab4982b81bdf14b95cfbf9ec1be61bf61">More...</a><br/></td></tr>
<tr class="separator:gab4982b81bdf14b95cfbf9ec1be61bf61"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1d8ce761d128ed9438878593bc349c36"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xsecure__ecdsa__server__apis.html#ga1d8ce761d128ed9438878593bc349c36">XSecure_EllipticGetCrvSize</a> (const <a class="el" href="group__xsecure__common__apis.html#ga7aecdb57be4a4242f11ad3e3bebb42e6">XSecure_EllipticCrvTyp</a> CrvType)</td></tr>
<tr class="memdesc:ga1d8ce761d128ed9438878593bc349c36"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function gets curve size in bytes.  <a href="group__xsecure__ecdsa__server__apis.html#ga1d8ce761d128ed9438878593bc349c36">More...</a><br/></td></tr>
<tr class="separator:ga1d8ce761d128ed9438878593bc349c36"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
